package com.TropicalFlavor.controller;

import com.TropicalFlavor.po.MarketUser;
import com.TropicalFlavor.tool.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class HomeController
{
    @RequestMapping(value = {"/","/home.do"})
    public String home(HttpServletRequest request, Model model)
    {
        MarketUser marketUser = (MarketUser) request.getSession().getAttribute("marketUser");
        if(!StringUtils.getInstance().isNullOrEmpty(marketUser))
        {
            model.addAttribute("marketUser", marketUser);
        }
        else
        {
            marketUser = new MarketUser();
            model.addAttribute("marketUser", marketUser);
        }
        try
        {

        }
        catch (Exception e)
        {
            e.printStackTrace();
            return "page/login_page";
        }
        return "index";
    }
}
